package reflect;

import reflect.annotations.AutoRunClass;
import reflect.annotations.AutoRunMethod;

/**
 * 使用当前类测试反射机制
 */
@AutoRunClass
public class Person {

    private String name = "张三";
    private int age = 20;

    public Person(){}

    public Person(String name){
        this.name = name;
    }

    public Person( String name,  int age){
        this.name = name;
        this.age = age;
    }
    public void sayHello(){
        System.out.println(name+"hello");
    }
    public void sayHi(){
        System.out.println(name+"Hi");
    }
    @AutoRunMethod(value = 2)
    public void doSome(){
        System.out.println(name+"干事");
    }
    @AutoRunMethod(9)
    public void sleep(){
        System.out.println(name+"睡觉");
    }
    @AutoRunMethod
    public void watchTV(){
        System.out.println(name+"看电视");
    }
    public void study(){
        System.out.println(name+"学习");
    }
    public void playGame(){
        System.out.println(name+"玩游戏");
    }
    public void sing(){
        System.out.println(name+"唱歌");
    }
    public void say(String info){
        System.out.println(name+"："+info);
    }
    public void say(String info,int count){
        for (int i=0 ;i<count;i++){
            System.out.println(name+"："+info);
        }
    }
    private void hehe(){
        System.out.println("快点解封沙拉的发动机");
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
